home *** CD-ROM | disk | FTP | other *** search
/ Clickx 75 / Clickx 75.iso / software / expressionweb / expressionwebv3 / ExpressionWeb_en.exe / Setup / WeConen.cab / xweb.slideshow.SLDSHOW.XSL.en < prev    next >
Encoding:
Extensible Markup Language  |  2009-06-09  |  13.2 KB  |  375 lines

  1. <?xml version="1.0" ?> 
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
  3.  
  4. <xsl:script>
  5. <![CDATA[
  6.     //generate a random int to identify the functions and objects in this gallery
  7.     var rnd = Math.round(Math.random() * 10000);
  8.     var rnd2 = rnd;
  9.     var TRAY_WIDTH = 640;
  10.     var totalLength = 20;
  11.     
  12.     function getRandom() {
  13.         rnd2 = Math.round(Math.random() * 10000);
  14.         return rnd2;
  15.     }
  16.  
  17.     function notEmpty(e) {
  18.         var childList = e.selectSingleNode("//pictures").childNodes;
  19.         if (childList.length > 0)
  20.             return true;
  21.         else
  22.             return false;
  23.     }
  24.  
  25.     function getHeight(e) {
  26.         var childList = e.selectSingleNode("//pictures").childNodes;
  27.         var maxHeight = 0;
  28.         var iHeight = 0;
  29.         for (var i=0;i<childList.length;i++) {
  30.           iHeight = parseInt(childList[i].getAttribute("thumbheight"))
  31.           if ( iHeight > maxHeight) maxHeight = iHeight;
  32.         }
  33.         return maxHeight;
  34.     }
  35.  
  36.     function disableRight(e) {
  37.         var childList = e.selectNodes("//picture");
  38.         var iWidth = 20;
  39.         for (i=0;i<childList.length;i++) {
  40.             iWidth += parseInt(childList[i].getAttribute("thumbwidth")) + 20;
  41.         }
  42.  
  43.         if (iWidth > getWidth(e))
  44.             return false;
  45.         return true;
  46.     }
  47.  
  48.     function previewImgChk(e) {
  49.         //always return true if we're not generating a preview
  50.         if (!e.selectSingleNode("/xml[@output='preview']")) return true;
  51.         
  52.         //figure out the most thumbnails we can show in the space defined by TRAY_WIDTH
  53.         var childList = e.selectNodes("//picture");
  54.         var iWidth = 20;
  55.         for (i=0;i<childList.length;i++) {
  56.             iWidth += parseInt(childList[i].getAttribute("thumbwidth")) + 20;
  57.             if (iWidth > TRAY_WIDTH) {
  58.                 break;
  59.             }
  60.         }
  61.         
  62.         // return false if this element is above that number
  63.         if (childNumber(e) <= i) {
  64.             return true;
  65.         } else {
  66.             return false;
  67.         }
  68.     }
  69.  
  70.     function getWidth(e) {
  71.         //figure out the most thumbnails we can show in the space defined by TRAY_WIDTH
  72.         var childList = e.selectNodes("//picture");
  73.         var iWidth = 20;
  74.         for (i=0;i<childList.length;i++) {
  75.             iWidth += parseInt(childList[i].getAttribute("thumbwidth")) + 20;
  76.             if (iWidth > TRAY_WIDTH) {
  77.                 return iWidth - parseInt(childList[i].getAttribute("thumbwidth")) - 20;
  78.             }
  79.         }
  80.  
  81.         return iWidth;
  82.     }
  83.         
  84.     function BreakLine(e) {
  85.         totalLength += parseInt(e.getAttribute("thumbwidth")) + 20;
  86.         if ( totalLength > getWidth(e))
  87.         {
  88.             totalLength = 40 + parseInt(e.getAttribute("thumbwidth"));
  89.             return true;
  90.         }
  91.         else{
  92.             return false;
  93.         }
  94.     }
  95.  
  96.     function isPreviewOutput(e) {
  97.         if (e.selectSingleNode("/xml[@output='preview']")) {
  98.             return true;
  99.         } else {
  100.             return false;
  101.         }
  102.     }
  103. ]]>
  104. </xsl:script>
  105.  
  106. <!--
  107.     the template block describes this template.
  108.     this info is used by FP when building the photo gallery dialog
  109. -->
  110. <template>
  111.     <title>Slide Show</title>
  112.     <description>- Thumbnails of your images are created automatically.
  113. - Thumbnail images are arranged in a row that scrolls across the top.
  114. - The selected image is displayed full-size in the center.
  115. - Descriptive text is placed below the full-size image.
  116. </description>
  117.     <defaults imgPerRow="2" thumbWidth="100" />
  118.     <dependent-files>
  119.         <file name="scripts" path="sldshow.js"/>
  120.         <file name="prev" path="prev.gif"/>
  121.         <file name="next" path="next.gif"/>
  122.         <file name="prevdis" path="prevdis.gif"/>
  123.         <file name="nextdis" path="nextdis.gif"/>
  124.     </dependent-files>
  125. </template>
  126.  
  127. <xsl:template><xsl:copy><xsl:apply-templates select="@* | * | comment() | pi() | text()"/></xsl:copy></xsl:template>
  128.  
  129. <xsl:template match="/">
  130.     <xsl:apply-templates select="xml"/>
  131. </xsl:template>
  132.  
  133.  
  134. <!-- this is the preview HTML we generate for display inside FP -->
  135. <xsl:template match="xml[@output = 'preview']">
  136. <html>
  137. <head>    
  138. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  139. <title><xsl:value-of select="//options/@pageName"/></title>
  140. </head>
  141. <body>
  142. <div align="center">
  143. <center>
  144. <table border="0" cellspacing="0" cellpadding="5" width="700" dir="ltr">
  145.     <tr>
  146.         <td nowrap="" align="center">
  147.         <img border="0" align="middle">
  148.         <xsl:attribute name="src"><xsl:value-of select="//dependent-files/file[@name='prevdis']/@path"/></xsl:attribute> 
  149.         </img>
  150.  
  151.         <xsl:for-each select="//pictures">
  152.             <xsl:apply-templates select="picture"/>
  153.         </xsl:for-each>
  154.         
  155.         <img border="0" align="middle">
  156.         <xsl:attribute name="src"><xsl:value-of select="//dependent-files/file[@name='nextdis']/@path"/></xsl:attribute> 
  157.         </img>
  158.         <hr style="height:1"/>
  159.         </td>
  160.     </tr>
  161. </table>
  162. <xsl:if expr="notEmpty(this)">
  163. <img>
  164.     <xsl:attribute name="width"><xsl:value-of select="//pictures/picture[0]/@filewidth"/></xsl:attribute>
  165.     <xsl:attribute name="height"><xsl:value-of select="//pictures/picture[0]/@fileheight"/></xsl:attribute>
  166.     <xsl:attribute name="src"><xsl:value-of select="//pictures/picture[0]/@file-href"/></xsl:attribute>
  167. </img>
  168. </xsl:if>
  169. <div>
  170.     <xsl:apply-templates select="//pictures/picture[0]/caption"/>
  171. </div>
  172. <div>
  173.     <xsl:apply-templates select="//pictures/picture[0]/desc"/>
  174. </div>
  175. </center>
  176. </div>
  177. </body>
  178. </html>
  179. </xsl:template>
  180.  
  181.  
  182. <!-- this is what gets generated for the actual gallery -->
  183. <xsl:template match="xml[@output = 'real']">
  184. <html>
  185. <head>
  186. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  187. <title><xsl:value-of select="//options/@pageName"/></title>
  188. </head>
  189. <body>
  190. <picture file-href="real_p.htm" /> 
  191. <picture file-href="real_x.htm" />
  192. <div align="center">
  193. <center>
  194. <layer visibility="hide">
  195. <div style="display:none;">
  196.     <xsl:attribute name="id">fpGalleryCaptions_<xsl:eval>rnd</xsl:eval></xsl:attribute>
  197.     <xsl:for-each select="//caption"><div><xsl:apply-templates/></div></xsl:for-each>
  198. </div>
  199. <div style="display:none;">
  200.     <xsl:attribute name="id">fpGalleryDescriptions_<xsl:eval>rnd</xsl:eval></xsl:attribute>
  201.     <xsl:for-each select="//desc"><div><xsl:apply-templates/></div></xsl:for-each>    
  202. </div>
  203. </layer>
  204. <script language="javascript">
  205. <xsl:attribute name="src"><xsl:value-of select="//dependent-files/file[@name='scripts']/@path"/></xsl:attribute>
  206. <xsl:comment/>
  207. </script>
  208. <table border="0" cellspacing="0" cellpadding="5" width="700" dir="ltr">
  209.     <tr>
  210.         <td nowrap="" align="center">    
  211.         <layer visibility="hide">
  212.         <img border="0" align="middle">
  213.         <xsl:attribute name="src"><xsl:value-of select="//dependent-files/file[@name='prevdis']/@path"/></xsl:attribute> 
  214.         <xsl:attribute name="lowsrc"><xsl:value-of select="//dependent-files/file[@name='prev']/@path"/></xsl:attribute>
  215.         <xsl:attribute name="id">fpGalleryLeftBtn_<xsl:eval>rnd</xsl:eval></xsl:attribute>
  216.         <xsl:attribute name="onclick">JavaScript:fp_ScrollLeft(<xsl:eval>rnd</xsl:eval>)</xsl:attribute>
  217.         </img>
  218.         </layer>
  219.         
  220.         <script language="JavaScript1.1">
  221.         <xsl:comment>
  222.         if (fp_ie4()) {
  223.             document.write("<span align='center' style='width:<xsl:eval>getWidth(this)</xsl:eval>;overflow:hidden' id='fpGalleryListCell_<xsl:eval>rnd</xsl:eval>'>");
  224.         }
  225.         if (fp_ns6()) {            
  226.             document.getElementById("fpGalleryLeftBtn_<xsl:eval>rnd</xsl:eval>").style.visibility="hidden"
  227.         }
  228.         </xsl:comment>
  229.         </script>
  230.             <xsl:for-each select="//pictures">
  231.                 <xsl:apply-templates />
  232.             </xsl:for-each>
  233.             <span><xsl:attribute name="style">width:0;height:<xsl:eval>getHeight(this)</xsl:eval>;visibility:hidden</xsl:attribute>.</span>
  234.         <script language="JavaScript1.1">
  235.         <xsl:comment>
  236.         if (fp_ie4()) {
  237.             document.write("</span>");
  238.         }
  239.         </xsl:comment>
  240.         </script>
  241.  
  242.         <layer visibility="hide">
  243.         <xsl:choose>
  244.         <xsl:when expr="disableRight(this)">
  245.             <img border="0" align="middle">
  246.             <xsl:attribute name="src"><xsl:value-of select="//dependent-files/file[@name='nextdis']/@path"/></xsl:attribute> 
  247.             <xsl:attribute name="lowsrc"><xsl:value-of select="//dependent-files/file[@name='next']/@path"/></xsl:attribute>
  248.             <xsl:attribute name="id">fpGalleryRightBtn_<xsl:eval>rnd</xsl:eval></xsl:attribute>
  249.             <xsl:attribute name="onclick">JavaScript:fp_ScrollRight(<xsl:eval>rnd</xsl:eval>)</xsl:attribute>
  250.             <script language="JavaScript1.1">
  251.                 if (fp_ns6()) {            
  252.                         document.getElementById("fpGalleryRightBtn_<xsl:eval>rnd</xsl:eval>").style.visibility="hidden"
  253.                 }
  254.  
  255.             </script>
  256.             </img>
  257.         </xsl:when>
  258.         <xsl:otherwise>
  259.             <img border="0" align="middle">
  260.             <xsl:attribute name="src"><xsl:value-of select="//dependent-files/file[@name='next']/@path"/></xsl:attribute> 
  261.             <xsl:attribute name="lowsrc"><xsl:value-of select="//dependent-files/file[@name='nextdis']/@path"/></xsl:attribute>
  262.             <xsl:attribute name="id">fpGalleryRightBtn_<xsl:eval>rnd</xsl:eval></xsl:attribute>
  263.             <xsl:attribute name="onclick">JavaScript:fp_ScrollRight(<xsl:eval>rnd</xsl:eval>)</xsl:attribute>
  264.             </img>
  265.             <script language="JavaScript1.1">
  266.                 rightdisabled = false
  267.                 widthLength = <xsl:eval>getWidth(this)</xsl:eval>
  268.                 if (fp_ns6()) {            
  269.                         document.getElementById("fpGalleryRightBtn_<xsl:eval>rnd</xsl:eval>").style.visibility="hidden"
  270.                 }
  271.  
  272.             </script>
  273.         </xsl:otherwise>
  274.         </xsl:choose>
  275.         </layer>
  276.         <hr width='95%' size='1' color='#000000' />
  277.         </td>
  278.     </tr>
  279. </table>
  280. <img>
  281.     <xsl:attribute name="id">fpGalleryMainImg_<xsl:eval>rnd</xsl:eval></xsl:attribute>
  282.     <xsl:attribute name="name">fpGalleryMainImg_<xsl:eval>rnd</xsl:eval></xsl:attribute>                
  283.     <xsl:attribute name="width"><xsl:value-of select="//pictures/picture[0]/@filewidth"/></xsl:attribute>
  284.     <xsl:attribute name="height"><xsl:value-of select="//pictures/picture[0]/@fileheight"/></xsl:attribute>
  285.     <xsl:attribute name="src"><xsl:value-of select="//pictures/picture[0]/@file-href"/></xsl:attribute>
  286.     <xsl:attribute name="title"><xsl:value-of select="//pictures/picture[0]/caption"/></xsl:attribute>
  287. </img>
  288. <layer visibility="hide">
  289. <div>
  290.     <xsl:attribute name="id">fpGalleryCaptionCell_<xsl:eval>rnd</xsl:eval></xsl:attribute>
  291.     <xsl:apply-templates select="//pictures/picture[0]/caption"/>
  292. </div>
  293. <div>
  294.     <xsl:attribute name="id">fpGalleryDescCell_<xsl:eval>rnd</xsl:eval></xsl:attribute>
  295.     <xsl:apply-templates select="//pictures/picture[0]/desc"/>
  296. </div>
  297. </layer>
  298. </center>
  299. </div>
  300. </body>
  301. </html>
  302. </xsl:template>
  303.  
  304. <!-- this is the output we generate for each sub page of the gallery -->
  305. <xsl:template match="xml[@output='subpage']">
  306. <html>
  307. <head>
  308. <title><xsl:value-of select="//picture/caption"/></title>
  309. </head>
  310. <body>
  311. <div align="center">
  312.     <table width="100%" align="center">
  313.         <tr>
  314.             <td width="100%" align="center" colspan="3">
  315.             <img hspace="10" border="0">
  316.             <xsl:attribute name="width"><xsl:value-of select="//picture/@filewidth"/></xsl:attribute>
  317.             <xsl:attribute name="height"><xsl:value-of select="//picture/@fileheight"/></xsl:attribute>
  318.             <xsl:attribute name="src"><xsl:value-of select="//picture/@file-href"/></xsl:attribute>
  319.             <xsl:attribute name="title"><xsl:value-of select="//picture/caption"/></xsl:attribute>
  320.             </img>
  321.             </td>
  322.         </tr>
  323.         <tr><td colspan="3"><xsl:apply-templates select="//picture/caption"/></td></tr>
  324.         <tr><td colspan="3"><xsl:apply-templates select="//picture/desc"/></td></tr>
  325.         <tr>
  326.             <td><a><xsl:attribute name="href"><xsl:value-of select="//picture/@prevImgPath"/></xsl:attribute>Previous Image</a></td>
  327.             <td><a><xsl:attribute name="href"><xsl:value-of select="//picture/@galleryPath"/></xsl:attribute>Back To Gallery</a></td>
  328.             <td><a><xsl:attribute name="href"><xsl:value-of select="//picture/@nextImgPath"/></xsl:attribute>Next Image</a></td>
  329.         </tr>
  330.     </table>
  331. </div>
  332. </body>
  333. </html>
  334. </xsl:template>
  335.  
  336. <xsl:template match="picture">
  337.     <xsl:if expr="previewImgChk(this)">
  338.     <xsl:choose>
  339.     <xsl:when expr="isPreviewOutput(this)">
  340.         <img hspace="10" vspace="5" border="0">
  341.             <xsl:attribute name="src"><xsl:value-of select="@thumb-href"/></xsl:attribute>
  342.             <xsl:attribute name="width"><xsl:value-of select="@thumbwidth"/></xsl:attribute>
  343.             <xsl:attribute name="height"><xsl:value-of select="@thumbheight"/></xsl:attribute>
  344.             <xsl:attribute name="title"><xsl:value-of select="./caption"/></xsl:attribute>
  345.             <xsl:attribute name="align">absmiddle</xsl:attribute>                        
  346.         </img>
  347.     </xsl:when>
  348.     <xsl:otherwise>
  349.         <xsl:if expr="BreakLine(this)">
  350.             <script language="JavaScript1.1">
  351.             <xsl:comment>
  352.             if (fp_ns6()) {            
  353.                 document.write("<br />");
  354.             }
  355.             </xsl:comment>
  356.             </script>
  357.         </xsl:if>
  358.  
  359.         <a target="_self"><xsl:attribute name="href">Javascript:fp_ShowImg(document['fpphoto_<xsl:eval>getRandom()</xsl:eval>'],'<xsl:value-of select="@filewidth"/>','<xsl:value-of select="@fileheight"/>','<xsl:eval>rnd</xsl:eval>',<xsl:eval>childNumber(this) - 1</xsl:eval>);</xsl:attribute>
  360.         <img hspace="10" vspace="5" border="0">
  361.             <xsl:attribute name="src"><xsl:value-of select="@thumb-href"/></xsl:attribute>
  362.             <xsl:attribute name="id">fpphoto_<xsl:eval>rnd2</xsl:eval></xsl:attribute>
  363.             <xsl:attribute name="name">fpphoto_<xsl:eval>rnd2</xsl:eval></xsl:attribute>
  364.             <xsl:attribute name="lowsrc"><xsl:value-of select="@file-href"/></xsl:attribute>
  365.             <xsl:attribute name="width"><xsl:value-of select="@thumbwidth"/></xsl:attribute>
  366.             <xsl:attribute name="height"><xsl:value-of select="@thumbheight"/></xsl:attribute>
  367.             <xsl:attribute name="title"><xsl:value-of select="./caption"/></xsl:attribute>
  368.             <xsl:attribute name="align">absmiddle</xsl:attribute>                        
  369.         </img></a>    
  370.     </xsl:otherwise>
  371.     </xsl:choose>
  372.     </xsl:if>
  373. </xsl:template>
  374.  
  375. <xsl:template match="caption | desc"><xsl:apply-templates /></xsl:template></xsl:stylesheet>